package gold.digger;

import gold.utils.InputUtil;

import java.util.Arrays;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC1984 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int minimumDifference(int[] nums, int k) {
            Arrays.sort(nums);
            int n = nums.length, ans = nums[k - 1] - nums[0];
            for (int i = k; i < n; i++) {
                ans = Math.min(ans, nums[i] - nums[i - k + 1]);
            }
            return ans;
        }
    }


    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC1984 an = new LC1984();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
